// 安装插件时会node运行此文件

const fs = require('fs');
const path = require('path');
const plist = require('plist');

(function(){
    let workPath = process.cwd();
    let infoPath = path.join(workPath, 'platforms/ios/eeuiApp/eeuiApp/Info.plist');
    //
    if (!fs.existsSync(infoPath)) {
        return;
    }
    let infoContent = fs.readFileSync(infoPath, 'utf8');
    let infoObject = plist.parse(infoContent);
    if (typeof infoObject['NSFaceIDUsageDescription'] == "undefined") {
        infoObject['NSFaceIDUsageDescription'] = "$(PRODUCT_NAME) 需要验证身份来继续操作";
        fs.writeFileSync(infoPath, plist.build(infoObject), 'utf8');
    }
})();
